#ifndef STATEMACHINE_H_
#define STATEMACHINE_H_ 
// Defines indices in state table

#define letter 0
#define underscore 1
#define digit 2
#define tuborg_B 3
#define tuborg_E 4
#define paranthesis_B 5
#define paranthesis_E 6
#define _plus 7
#define _minus 8
#define _multiply 9
#define front_slash 10
#define modulo 11
#define single_and 12
#define pipe 13 
#define exclamation 14
#define less_than 15
#define greater_than 16
#define equals 17
#define dot 18
#define semicolon 19
#define whitespace 20
#define AE 21
#define comma 22

#define BU 25
#define accept 26
#define in_keyword_list 23
#define not_in_keyword_list 24
#define N_keywords 5
#define st_lexture 0
#define st_token 1
#define st_value 2

struct symbol{
  char lexture[16];
  char token[16];
  signed int value;
} ;

std::vector<symbol> symboltable;
std::vector<int> lexemeArray;

string keyword_list[N_keywords] = {"if", "else", "while", "input", "output"};

const unsigned char statetable[33][27] =
{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{16,16,20,24,25,22,23,2,2,2,3,2,15,13,9,6,6,11,26,27,29,'E',31,'d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,5,5,5,5,5,5,5,'d','d','n','n'},
{4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,1,4,4,4,'d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,8,8,8,8,8,'d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,7,10,10,10,10,10,'d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,7,12,12,12,12,12,'d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{'E','E','E','E','E','E','E','E','E','E','E','E','E',14,'E','E','E','E','E','E','E','E','E','d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{'E','E','E','E','E','E','E','E','E','E','E','E',14,'E','E','E','E','E','E','E','E','E','E','d','d','n','n'},
{16,16,16,19,19,19,19,19,19,19,19,19,19,19,19,19,19,32,16,19,19,19,19,'d','d','n','n'},
{'d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d',18,19,'y','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{21,21,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,21,21,21,21,'d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','y','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{'d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','d','n','n'},
{30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,29,30,'E','d','d','n','n'},
{16,16,20,24,25,22,23,2,2,2,3,2,15,13,9,6,6,11,26,27,29,31,'E','d','d','n','n'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,'d','d','n','y'},
{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,'d','d','y','y'}};
#endif /*STATEMACHINE_H_*/